package com.example.forum.mapper;

import com.example.forum.entity.Token;
import org.apache.ibatis.annotations.*;

public interface TokenMapper {

//添加token
    @Insert("insert into token(token,user_id)values(#{token.token},#{token.userId})")
    @Options(useGeneratedKeys = true,keyProperty = "id")
    int insert(@Param("token") Token token);
    //根据token查userID
    @Select("select user_id from token where token=#{token} order by id desc limit 1")
    Integer UidSelect(@Param("token") String token);

    @Delete("delete from token where token=#{token}")
    int delete(@Param("token") String token);
}
